/**
 * @summary: Feedback 入口，放置在全局布局中
 * @author: lixinxiang@vv.cn
 */

import React, { useCallback, useState } from 'react';
import { FAB } from '../components';
import FeedbackModal from './FeedbackModal';

const FeedbackFAB = () => {
    const [visible, setVisible] = useState(false);

    /* 显示 Feedback 弹窗 */
    const handleClickFAB = useCallback(() => {
        setVisible(true);
    }, [setVisible]);

    const handleCancel = useCallback(() => {
        setVisible(false);
    }, [setVisible]);

    return (
        <>
            <FAB onClick={handleClickFAB} />
            <FeedbackModal visible={visible} onCancel={handleCancel} onFinish={handleCancel} />
        </>
    );
};

export default FeedbackFAB;
